﻿using LZ.DCode;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;


namespace LZ.HzStorage.EntityFrameworkCore
{
    /// <summary>
    /// LZ���ݿ�����
    /// </summary>
    public class HzStorageDbContextFactory : DbContextFactory<HzStorageDbContext>
    {
        public override string ConnectionStringName => DCodeConsts.ConnectionStringName;

        public override HzStorageDbContext CreateDbContext(DbContextOptions<HzStorageDbContext> options)
        {
            return new HzStorageDbContext(options);
        }

        //public HzStorageDbContext CreateDbContext(string[] args)
        //{
        //    var builder = new DbContextOptionsBuilder<HzStorageDbContext>();
        //    var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

        //    HzStorageDbContextConfigurer.Configure(builder, configuration.GetConnectionString(HzStorageConsts.ConnectionStringName));

        //    return new HzStorageDbContext(builder.Options);
        //}
    }
}

